﻿using Core.Framework.Model.Common;
using System;
using System.Collections.Generic;
using System.Text;
using Core.DataAccess.Model.Projects;

namespace Core.IBusiness.IProjectModule
{
    /// <summary>
    /// API用户服务
    /// </summary>
    public interface IProjectUserApiService
    {

        /// <summary>
        /// 用户添加订单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        MethodResult<int> UserAddOrder(ProjectUserApiOrder model);

        /// <summary>
        /// 用户订单付款
        /// </summary>
        /// <param name="key">订单关键字</param>
        /// <returns></returns>
        MethodResult<int> UserOrderPay(int key);


        /// <summary>
        /// 检查指定API是否可用
        /// </summary>
        /// <param name="projectKey">项目关键字</param>
        /// <param name="apiKey">API关键字</param>
        /// <returns></returns>
        MethodResult<KeyValuePair<bool, int>> IsApiAvailability(int projectKey,int apiKey);

        /// <summary>
        /// 获取服务列表
        /// </summary>
        /// <param name="projectKey">项目ID</param>
        /// <returns></returns>
        MethodResult<List<ProjectApiInfo>> GetProjectApiList(int projectKey);
        

        /// <summary>
        /// 获取订单列表
        /// </summary>
        /// <param name="userKey">用户键字</param>
        /// <param name="pagination">分页参数</param>
        /// <returns></returns>
        MethodResult<List<ProjectUserApiOrder>> GetUserOrders(int userKey, Pagination pagination);

        /// <summary>
        /// 获取订单需支付金额
        /// </summary>
        /// <param name="key">获取订单关键字</param>
        /// <returns></returns>
        MethodResult<decimal> GetOrderPrice(int key);

        /// <summary>
        /// 获取订单信息
        /// </summary>
        /// <param name="key">订单号</param>
        /// <returns></returns>
        MethodResult<ProjectUserApiOrder> GetOrder(int key);


        /// <summary>
        /// 使用计数服务
        /// 触发计数器计算
        /// </summary>
        /// <param name="projectKey">项目关键字</param>
        /// <param name="apiKey">API关键字</param>
        /// <returns></returns>
        MethodResult UseApiCount(int projectKey, int apiKey);

    }
}
